<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // const r1 = /(ab){2,}/g;
      // const r1 = /(ab)+/g; //{1,}
      // const r1 = /(ab)*/g; //{0,}
      const r1 = /(ab)?/g; //{0,1}
      const str = `hello abababab  ababab  abab  abababababab`;
      console.log(str.match(r1));
    </script>
  </body>
</html>
